package Controller;

import Helper.*;
import Model.*;

public class VendorController {
    private static Vendor v = null;

    public static boolean login(String username, String password){
        VendorM vendorM = new VendorM();

        v = vendorM.login(username, password);

        if( v != null ){
            Helper.setSession(0, v.name);
            Helper.setSession(1, String.valueOf(v.id));

            return true;
        }else{
            Helper.waitter();

            return false;
        }
    }

    public static boolean signup(String username, String password){
        VendorM vendorM = new VendorM();

        return vendorM.signup(username, password);
    }

    public static boolean addProduct(String name, float price, int amount, int status){
        return v.addProduct(name, price, amount, status);
    }

    public static boolean editProduct(int id, String name, float price, int amount, int status){
        return v.editProduct(id, name, price, amount, status);
    }

    public static boolean removeProduct(int id){
        return v.removeProduct(id);
    }
}
